<!DOCTYPE HTML>
<html lang="en" >
    
    <head>
        
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <title>State 范式化 | Redux 中文文档 Join the chat at https://gitter.im/camsong/redux-in-chinese</title>
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <meta name="description" content="">
        <meta name="generator" content="GitBook 2.3.3">
        
        
        <meta name="HandheldFriendly" content="true"/>
        <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
        <meta name="apple-mobile-web-app-capable" content="yes">
        <meta name="apple-mobile-web-app-status-bar-style" content="black">
        <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../../../gitbook/images/apple-touch-icon-precomposed-152.png">
        <link rel="shortcut icon" href="../../../gitbook/images/favicon.ico" type="image/x-icon">
        
    <link rel="stylesheet" href="../../../gitbook/style.css">
    
        
        <link rel="stylesheet" href="../../../gitbook/plugins/gitbook-plugin-edit-link/plugin.css">
        
    
        
        <link rel="stylesheet" href="../../../gitbook/plugins/gitbook-plugin-prism/prism.css">
        
    
    

        
    
    
    <link rel="next" href="../../../docs/recipes/reducers/UpdatingNormalizedData.html" />
    
    
    <link rel="prev" href="../../../docs/recipes/reducers/BeyondCombineReducers.html" />
    

        
    </head>
    <body>
        
        
    <div class="book" data-level="4.9.7" data-basepath="../../.." data-revision="Thu Mar 16 2017 23:41:56 GMT+0800 (CST)">
    

<div class="book-summary">
    <div class="book-search">
        <input type="text" placeholder="Type to search" class="form-control" />
    </div>
    <ul class="summary">
        
        
        
        

        

        
    
        <li class="chapter " data-level="0" data-path="index.html">
            
                
                    <a href="../../../index.html">
                
                        <i class="fa fa-check"></i>
                        
                        自述
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1" data-path="docs/introduction/index.html">
            
                
                    <a href="../../../docs/introduction/index.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.</b>
                        
                        介绍
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.1" data-path="docs/introduction/Motivation.html">
            
                
                    <a href="../../../docs/introduction/Motivation.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.1.</b>
                        
                        动机
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="docs/introduction/CoreConcepts.html">
            
                
                    <a href="../../../docs/introduction/CoreConcepts.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.2.</b>
                        
                        核心概念
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="docs/introduction/ThreePrinciples.html">
            
                
                    <a href="../../../docs/introduction/ThreePrinciples.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.3.</b>
                        
                        三大原则
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="docs/introduction/PriorArt.html">
            
                
                    <a href="../../../docs/introduction/PriorArt.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.4.</b>
                        
                        先前技术
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="docs/introduction/Ecosystem.html">
            
                
                    <a href="../../../docs/introduction/Ecosystem.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.5.</b>
                        
                        生态系统
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.6" data-path="docs/introduction/Examples.html">
            
                
                    <a href="../../../docs/introduction/Examples.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.6.</b>
                        
                        示例
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2" data-path="docs/basics/index.html">
            
                
                    <a href="../../../docs/basics/index.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.</b>
                        
                        基础
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.1" data-path="docs/basics/Actions.html">
            
                
                    <a href="../../../docs/basics/Actions.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.1.</b>
                        
                        Action
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.2" data-path="docs/basics/Reducers.html">
            
                
                    <a href="../../../docs/basics/Reducers.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.2.</b>
                        
                        Reducer
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.3" data-path="docs/basics/Store.html">
            
                
                    <a href="../../../docs/basics/Store.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.3.</b>
                        
                        Store
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.4" data-path="docs/basics/DataFlow.html">
            
                
                    <a href="../../../docs/basics/DataFlow.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.4.</b>
                        
                        数据流
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.5" data-path="docs/basics/UsageWithReact.html">
            
                
                    <a href="../../../docs/basics/UsageWithReact.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.5.</b>
                        
                        搭配 React
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.6" data-path="docs/basics/ExampleTodoList.html">
            
                
                    <a href="../../../docs/basics/ExampleTodoList.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.6.</b>
                        
                        示例：Todo List
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3" data-path="docs/advanced/index.html">
            
                
                    <a href="../../../docs/advanced/index.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.</b>
                        
                        高级
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.1" data-path="docs/advanced/AsyncActions.html">
            
                
                    <a href="../../../docs/advanced/AsyncActions.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.1.</b>
                        
                        异步 Action
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.2" data-path="docs/advanced/AsyncFlow.html">
            
                
                    <a href="../../../docs/advanced/AsyncFlow.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.2.</b>
                        
                        异步数据流
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.3" data-path="docs/advanced/Middleware.html">
            
                
                    <a href="../../../docs/advanced/Middleware.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.3.</b>
                        
                        Middleware
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.4" data-path="docs/advanced/UsageWithReactRouter.html">
            
                
                    <a href="../../../docs/advanced/UsageWithReactRouter.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.4.</b>
                        
                        搭配 React Router
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.5" data-path="docs/advanced/ExampleRedditAPI.html">
            
                
                    <a href="../../../docs/advanced/ExampleRedditAPI.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.5.</b>
                        
                        示例：Reddit API
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.6" data-path="docs/advanced/NextSteps.html">
            
                
                    <a href="../../../docs/advanced/NextSteps.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.6.</b>
                        
                        下一步
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="4" data-path="docs/recipes/index.html">
            
                
                    <a href="../../../docs/recipes/index.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.</b>
                        
                        技巧
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="4.1" data-path="docs/recipes/MigratingToRedux.html">
            
                
                    <a href="../../../docs/recipes/MigratingToRedux.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.1.</b>
                        
                        迁移到 Redux
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.2" data-path="docs/recipes/UsingObjectSpreadOperator.html">
            
                
                    <a href="../../../docs/recipes/UsingObjectSpreadOperator.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.2.</b>
                        
                        使用对象展开运算符
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.3" data-path="docs/recipes/ReducingBoilerplate.html">
            
                
                    <a href="../../../docs/recipes/ReducingBoilerplate.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.3.</b>
                        
                        减少样板代码
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.4" data-path="docs/recipes/ServerRendering.html">
            
                
                    <a href="../../../docs/recipes/ServerRendering.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.4.</b>
                        
                        服务端渲染
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.5" data-path="docs/recipes/WritingTests.html">
            
                
                    <a href="../../../docs/recipes/WritingTests.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.5.</b>
                        
                        编写测试
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.6" data-path="docs/recipes/ComputingDerivedData.html">
            
                
                    <a href="../../../docs/recipes/ComputingDerivedData.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.6.</b>
                        
                        计算衍生数据
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.7" data-path="docs/recipes/ImplementingUndoHistory.html">
            
                
                    <a href="../../../docs/recipes/ImplementingUndoHistory.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.7.</b>
                        
                        实现撤销重做
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.8" data-path="docs/recipes/IsolatingSubapps.html">
            
                
                    <a href="../../../docs/recipes/IsolatingSubapps.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.8.</b>
                        
                        子应用隔离
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.9" data-path="docs/recipes/StructuringReducers.html">
            
                
                    <a href="../../../docs/recipes/StructuringReducers.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.9.</b>
                        
                        组织 Reducer
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="4.9.1" data-path="docs/recipes/reducers/PrerequisiteConcepts.html">
            
                
                    <a href="../../../docs/recipes/reducers/PrerequisiteConcepts.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.9.1.</b>
                        
                        Reducer 基础概念
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.9.2" data-path="docs/recipes/reducers/BasicReducerStructure.html">
            
                
                    <a href="../../../docs/recipes/reducers/BasicReducerStructure.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.9.2.</b>
                        
                        Reducer 基础结构
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.9.3" data-path="docs/recipes/reducers/SplittingReducerLogic.html">
            
                
                    <a href="../../../docs/recipes/reducers/SplittingReducerLogic.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.9.3.</b>
                        
                        Reducer 逻辑拆分
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.9.4" data-path="docs/recipes/reducers/RefactoringReducersExample.html">
            
                
                    <a href="../../../docs/recipes/reducers/RefactoringReducersExample.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.9.4.</b>
                        
                        Reducer 重构示例
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.9.5" data-path="docs/recipes/reducers/UsingCombineReducers.html">
            
                
                    <a href="../../../docs/recipes/reducers/UsingCombineReducers.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.9.5.</b>
                        
                        `combineReducers` 用法
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.9.6" data-path="docs/recipes/reducers/BeyondCombineReducers.html">
            
                
                    <a href="../../../docs/recipes/reducers/BeyondCombineReducers.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.9.6.</b>
                        
                        `combineReducers` 进阶
                    </a>
            
            
        </li>
    
        <li class="chapter active" data-level="4.9.7" data-path="docs/recipes/reducers/NormalizingStateShape.html">
            
                
                    <a href="../../../docs/recipes/reducers/NormalizingStateShape.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.9.7.</b>
                        
                        State 范式化
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.9.8" data-path="docs/recipes/reducers/UpdatingNormalizedData.html">
            
                
                    <a href="../../../docs/recipes/reducers/UpdatingNormalizedData.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.9.8.</b>
                        
                        管理范式化数据
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.9.9" data-path="docs/recipes/reducers/ReusingReducerLogic.html">
            
                
                    <a href="../../../docs/recipes/reducers/ReusingReducerLogic.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.9.9.</b>
                        
                        Reducer 逻辑复用
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.9.10" data-path="docs/recipes/reducers/ImmutableUpdatePatterns.html">
            
                
                    <a href="../../../docs/recipes/reducers/ImmutableUpdatePatterns.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.9.10.</b>
                        
                        不可变更新模式
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.9.11" data-path="docs/recipes/reducers/InitializingState.html">
            
                
                    <a href="../../../docs/recipes/reducers/InitializingState.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.9.11.</b>
                        
                        初始化 State
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="5" data-path="docs/FAQ.html">
            
                
                    <a href="../../../docs/FAQ.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.</b>
                        
                        常见问题
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="5.1" data-path="docs/faq/General.html">
            
                
                    <a href="../../../docs/faq/General.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.1.</b>
                        
                        综合
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5.2" data-path="docs/faq/Reducers.html">
            
                
                    <a href="../../../docs/faq/Reducers.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.2.</b>
                        
                        Reducer
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5.3" data-path="docs/faq/OrganizingState.html">
            
                
                    <a href="../../../docs/faq/OrganizingState.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.3.</b>
                        
                        组织 State
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5.4" data-path="docs/faq/StoreSetup.html">
            
                
                    <a href="../../../docs/faq/StoreSetup.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.4.</b>
                        
                        创建 Store
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5.5" data-path="docs/faq/Actions.html">
            
                
                    <a href="../../../docs/faq/Actions.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.5.</b>
                        
                        Action
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5.6" data-path="docs/faq/CodeStructure.html">
            
                
                    <a href="../../../docs/faq/CodeStructure.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.6.</b>
                        
                        代码结构
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5.7" data-path="docs/faq/Performance.html">
            
                
                    <a href="../../../docs/faq/Performance.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.7.</b>
                        
                        性能
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5.8" data-path="docs/faq/ReactRedux.html">
            
                
                    <a href="../../../docs/faq/ReactRedux.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.8.</b>
                        
                        React Redux
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5.9" data-path="docs/faq/Miscellaneous.html">
            
                
                    <a href="../../../docs/faq/Miscellaneous.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.9.</b>
                        
                        其它
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="6" data-path="docs/Troubleshooting.html">
            
                
                    <a href="../../../docs/Troubleshooting.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.</b>
                        
                        排错
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="7" data-path="docs/Glossary.html">
            
                
                    <a href="../../../docs/Glossary.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>7.</b>
                        
                        词汇表
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="8" data-path="docs/api/index.html">
            
                
                    <a href="../../../docs/api/index.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>8.</b>
                        
                        API 文档
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="8.1" data-path="docs/api/createStore.html">
            
                
                    <a href="../../../docs/api/createStore.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>8.1.</b>
                        
                        createStore
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="8.2" data-path="docs/api/Store.html">
            
                
                    <a href="../../../docs/api/Store.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>8.2.</b>
                        
                        Store
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="8.3" data-path="docs/api/combineReducers.html">
            
                
                    <a href="../../../docs/api/combineReducers.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>8.3.</b>
                        
                        combineReducers
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="8.4" data-path="docs/api/applyMiddleware.html">
            
                
                    <a href="../../../docs/api/applyMiddleware.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>8.4.</b>
                        
                        applyMiddleware
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="8.5" data-path="docs/api/bindActionCreators.html">
            
                
                    <a href="../../../docs/api/bindActionCreators.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>8.5.</b>
                        
                        bindActionCreators
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="8.6" data-path="docs/api/compose.html">
            
                
                    <a href="../../../docs/api/compose.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>8.6.</b>
                        
                        compose
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="9" data-path="docs/react-redux/index.html">
            
                
                    <a href="../../../docs/react-redux/index.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>9.</b>
                        
                        react-redux 文档
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="9.1" data-path="docs/react-redux/api.html">
            
                
                    <a href="../../../docs/react-redux/api.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>9.1.</b>
                        
                        API
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="9.2" data-path="docs/react-redux/troubleshooting.html">
            
                
                    <a href="../../../docs/react-redux/troubleshooting.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>9.2.</b>
                        
                        排错
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="10" >
            
                
                    <a target="_blank" href="https:/github.com/react-guide/redux-tutorial-cn">
                
                        <i class="fa fa-check"></i>
                        
                            <b>10.</b>
                        
                        redux-tutorial
                    </a>
            
            
        </li>
    


        
        <li class="divider"></li>
        <li>
            <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
                Published with GitBook
            </a>
        </li>
        
    </ul>
</div>

    <div class="book-body">
        <div class="body-inner">
            <div class="book-header">
    <!-- Actions Left -->
    <a href="#" class="btn pull-left toggle-summary" aria-label="Table of Contents"><i class="fa fa-align-justify"></i></a>
    <a href="#" class="btn pull-left toggle-search" aria-label="Search"><i class="fa fa-search"></i></a>
    
    <div id="font-settings-wrapper" class="dropdown pull-left">
        <a href="#" class="btn toggle-dropdown" aria-label="Font Settings"><i class="fa fa-font"></i>
        </a>
        <div class="dropdown-menu font-settings">
    <div class="dropdown-caret">
        <span class="caret-outer"></span>
        <span class="caret-inner"></span>
    </div>

    <div class="buttons">
        <button type="button" id="reduce-font-size" class="button size-2">A</button>
        <button type="button" id="enlarge-font-size" class="button size-2">A</button>
    </div>

    <div class="buttons font-family-list">
        <button type="button" data-font="0" class="button">Serif</button>
        <button type="button" data-font="1" class="button">Sans</button>
    </div>

    <div class="buttons color-theme-list">
        <button type="button" id="color-theme-preview-0" class="button size-3" data-theme="0">White</button>
        <button type="button" id="color-theme-preview-1" class="button size-3" data-theme="1">Sepia</button>
        <button type="button" id="color-theme-preview-2" class="button size-3" data-theme="2">Night</button>
    </div>
</div>

    </div>

    <!-- Actions Right -->
    
    <div class="dropdown pull-right">
        <a href="#" class="btn toggle-dropdown" aria-label="Share"><i class="fa fa-share-alt"></i>
        </a>
        <div class="dropdown-menu font-settings dropdown-left">
            <div class="dropdown-caret">
                <span class="caret-outer"></span>
                <span class="caret-inner"></span>
            </div>
            <div class="buttons">
                <button type="button" data-sharing="twitter" class="button">
                    Share on Twitter
                </button>
                <button type="button" data-sharing="google-plus" class="button">
                    Share on Google
                </button>
                <button type="button" data-sharing="facebook" class="button">
                    Share on Facebook
                </button>
                <button type="button" data-sharing="weibo" class="button">
                    Share on Weibo
                </button>
                <button type="button" data-sharing="instapaper" class="button">
                    Share on Instapaper
                </button>
            </div>
        </div>
    </div>
    

    
    <a href="#" target="_blank" class="btn pull-right google-plus-sharing-link sharing-link" data-sharing="google-plus" aria-label="Google"><i class="fa fa-google-plus"></i></a>
    
    
    <a href="#" target="_blank" class="btn pull-right facebook-sharing-link sharing-link" data-sharing="facebook" aria-label="Facebook"><i class="fa fa-facebook"></i></a>
    
    
    <a href="#" target="_blank" class="btn pull-right twitter-sharing-link sharing-link" data-sharing="twitter" aria-label="Twitter"><i class="fa fa-twitter"></i></a>
    
    
    


    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="../../../" >Redux 中文文档 Join the chat at https://gitter.im/camsong/redux-in-chinese</a>
    </h1>
</div>

            <div class="page-wrapper" tabindex="-1">
                <div class="page-inner">
                
                
                    <section class="normal" id="section-">
                    
                        <a id="edit-link" href="https://github.com/camsong/redux-in-chinese/tree/master/docs/recipes/reducers/NormalizingStateShape.md" class="btn fa fa-edit pull-left">&#xA0;&#xA0;&#x5F00;&#x59CB;&#x7EA0;&#x9519;</a><h1 id="state-%E8%8C%83%E5%BC%8F%E5%8C%96">State &#x8303;&#x5F0F;&#x5316;</h1>
<p>&#x4E8B;&#x5B9E;&#x4E0A;&#xFF0C;&#x5927;&#x90E8;&#x5206;&#x7A0B;&#x5E8F;&#x5904;&#x7406;&#x7684;&#x6570;&#x636E;&#x90FD;&#x662F;&#x5D4C;&#x5957;&#x6216;&#x4E92;&#x76F8;&#x5173;&#x8054;&#x7684;&#x3002;&#x4F8B;&#x5982;&#xFF0C;&#x4E00;&#x4E2A;&#x535A;&#x5BA2;&#x4E2D;&#x6709;&#x591A;&#x7BC7;&#x6587;&#x7AE0;&#xFF0C;&#x6BCF;&#x7BC7;&#x6587;&#x7AE0;&#x6709;&#x591A;&#x6761;&#x8BC4;&#x8BBA;&#xFF0C;&#x6240;&#x6709;&#x7684;&#x6587;&#x7AE0;&#x548C;&#x8BC4;&#x8BBA;&#x53C8;&#x90FD;&#x662F;&#x7531;&#x7528;&#x6237;&#x4EA7;&#x751F;&#x7684;&#x3002;&#x8FD9;&#x79CD;&#x7C7B;&#x578B;&#x5E94;&#x7528;&#x7684;&#x6570;&#x636E;&#x770B;&#x4E0A;&#x53BB;&#x53EF;&#x80FD;&#x662F;&#x8FD9;&#x6837;&#x7684;&#xFF1A;</p>
<pre><code class="lang-javascript"><span class="token keyword">const</span> blogPosts <span class="token operator">=</span> <span class="token punctuation">[</span>
    <span class="token punctuation">{</span>
        id <span class="token punctuation">:</span> <span class="token string">&quot;post1&quot;</span><span class="token punctuation">,</span>
        author <span class="token punctuation">:</span> <span class="token punctuation">{</span>username <span class="token punctuation">:</span> <span class="token string">&quot;user1&quot;</span><span class="token punctuation">,</span> name <span class="token punctuation">:</span> <span class="token string">&quot;User 1&quot;</span><span class="token punctuation">}</span><span class="token punctuation">,</span>
        body <span class="token punctuation">:</span> <span class="token string">&quot;......&quot;</span><span class="token punctuation">,</span>
        comments <span class="token punctuation">:</span> <span class="token punctuation">[</span>
            <span class="token punctuation">{</span>
                id <span class="token punctuation">:</span> <span class="token string">&quot;comment1&quot;</span><span class="token punctuation">,</span>
                author <span class="token punctuation">:</span> <span class="token punctuation">{</span>username <span class="token punctuation">:</span> <span class="token string">&quot;user2&quot;</span><span class="token punctuation">,</span> name <span class="token punctuation">:</span> <span class="token string">&quot;User 2&quot;</span><span class="token punctuation">}</span><span class="token punctuation">,</span>
                comment <span class="token punctuation">:</span> <span class="token string">&quot;.....&quot;</span><span class="token punctuation">,</span>
            <span class="token punctuation">}</span><span class="token punctuation">,</span>
            <span class="token punctuation">{</span>
                id <span class="token punctuation">:</span> <span class="token string">&quot;comment2&quot;</span><span class="token punctuation">,</span>
                author <span class="token punctuation">:</span> <span class="token punctuation">{</span>username <span class="token punctuation">:</span> <span class="token string">&quot;user3&quot;</span><span class="token punctuation">,</span> name <span class="token punctuation">:</span> <span class="token string">&quot;User 3&quot;</span><span class="token punctuation">}</span><span class="token punctuation">,</span>
                comment <span class="token punctuation">:</span> <span class="token string">&quot;.....&quot;</span><span class="token punctuation">,</span>
            <span class="token punctuation">}</span>
        <span class="token punctuation">]</span>    
    <span class="token punctuation">}</span><span class="token punctuation">,</span>
    <span class="token punctuation">{</span>
        id <span class="token punctuation">:</span> <span class="token string">&quot;post2&quot;</span><span class="token punctuation">,</span>
        author <span class="token punctuation">:</span> <span class="token punctuation">{</span>username <span class="token punctuation">:</span> <span class="token string">&quot;user2&quot;</span><span class="token punctuation">,</span> name <span class="token punctuation">:</span> <span class="token string">&quot;User 2&quot;</span><span class="token punctuation">}</span><span class="token punctuation">,</span>
        body <span class="token punctuation">:</span> <span class="token string">&quot;......&quot;</span><span class="token punctuation">,</span>
        comments <span class="token punctuation">:</span> <span class="token punctuation">[</span>
            <span class="token punctuation">{</span>
                id <span class="token punctuation">:</span> <span class="token string">&quot;comment3&quot;</span><span class="token punctuation">,</span>
                author <span class="token punctuation">:</span> <span class="token punctuation">{</span>username <span class="token punctuation">:</span> <span class="token string">&quot;user3&quot;</span><span class="token punctuation">,</span> name <span class="token punctuation">:</span> <span class="token string">&quot;User 3&quot;</span><span class="token punctuation">}</span><span class="token punctuation">,</span>
                comment <span class="token punctuation">:</span> <span class="token string">&quot;.....&quot;</span><span class="token punctuation">,</span>
            <span class="token punctuation">}</span><span class="token punctuation">,</span>
            <span class="token punctuation">{</span>
                id <span class="token punctuation">:</span> <span class="token string">&quot;comment4&quot;</span><span class="token punctuation">,</span>
                author <span class="token punctuation">:</span> <span class="token punctuation">{</span>username <span class="token punctuation">:</span> <span class="token string">&quot;user1&quot;</span><span class="token punctuation">,</span> name <span class="token punctuation">:</span> <span class="token string">&quot;User 1&quot;</span><span class="token punctuation">}</span><span class="token punctuation">,</span>
                comment <span class="token punctuation">:</span> <span class="token string">&quot;.....&quot;</span><span class="token punctuation">,</span>
            <span class="token punctuation">}</span><span class="token punctuation">,</span>
            <span class="token punctuation">{</span>
                id <span class="token punctuation">:</span> <span class="token string">&quot;comment5&quot;</span><span class="token punctuation">,</span>
                author <span class="token punctuation">:</span> <span class="token punctuation">{</span>username <span class="token punctuation">:</span> <span class="token string">&quot;user3&quot;</span><span class="token punctuation">,</span> name <span class="token punctuation">:</span> <span class="token string">&quot;User 3&quot;</span><span class="token punctuation">}</span><span class="token punctuation">,</span>
                comment <span class="token punctuation">:</span> <span class="token string">&quot;.....&quot;</span><span class="token punctuation">,</span>
            <span class="token punctuation">}</span>
        <span class="token punctuation">]</span>    
    <span class="token punctuation">}</span>
    <span class="token comment" spellcheck="true">// and repeat many times</span>
<span class="token punctuation">]</span>
</code></pre>
<p>&#x4E0A;&#x9762;&#x7684;&#x6570;&#x636E;&#x7ED3;&#x6784;&#x6BD4;&#x8F83;&#x590D;&#x6742;&#xFF0C;&#x5E76;&#x4E14;&#x6709;&#x90E8;&#x5206;&#x6570;&#x636E;&#x662F;&#x91CD;&#x590D;&#x7684;&#x3002;&#x8FD9;&#x91CC;&#x8FD8;&#x5B58;&#x5728;&#x4E00;&#x4E9B;&#x8BA9;&#x4EBA;&#x5173;&#x5FC3;&#x7684;&#x95EE;&#x9898;&#xFF1A;</p>
<ul>
<li>&#x5F53;&#x6570;&#x636E;&#x5728;&#x591A;&#x5904;&#x5197;&#x4F59;&#x540E;&#xFF0C;&#x9700;&#x8981;&#x66F4;&#x65B0;&#x65F6;&#xFF0C;&#x5F88;&#x96BE;&#x4FDD;&#x8BC1;&#x6240;&#x6709;&#x7684;&#x6570;&#x636E;&#x90FD;&#x8FDB;&#x884C;&#x66F4;&#x65B0;&#x3002;</li>
<li>&#x5D4C;&#x5957;&#x7684;&#x6570;&#x636E;&#x610F;&#x5473;&#x7740; reducer &#x903B;&#x8F91;&#x5D4C;&#x5957;&#x66F4;&#x591A;&#x3001;&#x590D;&#x6742;&#x5EA6;&#x66F4;&#x9AD8;&#x3002;&#x5C24;&#x5176;&#x662F;&#x5728;&#x6253;&#x7B97;&#x66F4;&#x65B0;&#x6DF1;&#x5C42;&#x5D4C;&#x5957;&#x6570;&#x636E;&#x65F6;&#x3002;</li>
<li>&#x4E0D;&#x53EF;&#x53D8;&#x7684;&#x6570;&#x636E;&#x5728;&#x66F4;&#x65B0;&#x65F6;&#x9700;&#x8981;&#x72B6;&#x6001;&#x6811;&#x7684;&#x7956;&#x5148;&#x6570;&#x636E;&#x8FDB;&#x884C;&#x590D;&#x5236;&#x548C;&#x66F4;&#x65B0;&#xFF0C;&#x5E76;&#x4E14;&#x65B0;&#x7684;&#x5BF9;&#x8C61;&#x5F15;&#x7528;&#x4F1A;&#x5BFC;&#x81F4;&#x4E0E;&#x4E4B; connect &#x7684;&#x6240;&#x6709; UI &#x7EC4;&#x4EF6;&#x90FD;&#x91CD;&#x590D; render&#x3002;&#x5C3D;&#x7BA1;&#x8981;&#x663E;&#x793A;&#x7684;&#x6570;&#x636E;&#x6CA1;&#x6709;&#x53D1;&#x751F;&#x4EFB;&#x4F55;&#x6539;&#x53D8;&#xFF0C;&#x5BF9;&#x6DF1;&#x5C42;&#x5D4C;&#x5957;&#x7684;&#x6570;&#x636E;&#x5BF9;&#x8C61;&#x8FDB;&#x884C;&#x66F4;&#x65B0;&#x4E5F;&#x4F1A;&#x5F3A;&#x5236;&#x5B8C;&#x5168;&#x65E0;&#x5173;&#x7684; UI &#x7EC4;&#x4EF6;&#x91CD;&#x590D; render</li>
</ul>
<p>&#x6B63;&#x56E0;&#x4E3A;&#x5982;&#x6B64;&#xFF0C;&#x5728; Redux Store &#x4E2D;&#x7BA1;&#x7406;&#x5173;&#x7CFB;&#x6570;&#x636E;&#x6216;&#x5D4C;&#x5957;&#x6570;&#x636E;&#x7684;&#x63A8;&#x8350;&#x505A;&#x6CD5;&#x662F;&#x5C06;&#x8FD9;&#x4E00;&#x90E8;&#x5206;&#x89C6;&#x4E3A;&#x6570;&#x636E;&#x5E93;&#xFF0C;&#x5E76;&#x4E14;&#x5C06;&#x6570;&#x636E;&#x6309;&#x8303;&#x5F0F;&#x5316;&#x5B58;&#x50A8;&#x3002;</p>
<h2 id="%E8%AE%BE%E8%AE%A1%E8%8C%83%E5%BC%8F%E5%8C%96%E7%9A%84-state">&#x8BBE;&#x8BA1;&#x8303;&#x5F0F;&#x5316;&#x7684; State</h2>
<p>&#x8303;&#x5F0F;&#x5316;&#x7684;&#x6570;&#x636E;&#x5305;&#x542B;&#x4E0B;&#x9762;&#x51E0;&#x4E2A;&#x6982;&#x5FF5;&#xFF1A;</p>
<ul>
<li>&#x4EFB;&#x4F55;&#x7C7B;&#x578B;&#x7684;&#x6570;&#x636E;&#x5728; state &#x4E2D;&#x90FD;&#x6709;&#x81EA;&#x5DF1;&#x7684; &#x201C;&#x8868;&#x201D;&#x3002;</li>
<li>&#x4EFB;&#x4F55; &#x201C;&#x6570;&#x636E;&#x8868;&#x201D; &#x5E94;&#x5C06;&#x5404;&#x4E2A;&#x9879;&#x76EE;&#x5B58;&#x50A8;&#x5728;&#x5BF9;&#x8C61;&#x4E2D;&#xFF0C;&#x5176;&#x4E2D;&#x6BCF;&#x4E2A;&#x9879;&#x76EE;&#x7684; ID &#x4F5C;&#x4E3A; key&#xFF0C;&#x9879;&#x76EE;&#x672C;&#x8EAB;&#x4F5C;&#x4E3A; value&#x3002;</li>
<li>&#x4EFB;&#x4F55;&#x5BF9;&#x5355;&#x4E2A;&#x9879;&#x76EE;&#x7684;&#x5F15;&#x7528;&#x90FD;&#x5E94;&#x8BE5;&#x6839;&#x636E;&#x5B58;&#x50A8;&#x9879;&#x76EE;&#x7684; ID &#x6765;&#x5B8C;&#x6210;&#x3002;</li>
<li>ID &#x6570;&#x7EC4;&#x5E94;&#x8BE5;&#x7528;&#x4E8E;&#x6392;&#x5E8F;&#x3002;</li>
</ul>
<p>&#x4E0A;&#x9762;&#x535A;&#x5BA2;&#x793A;&#x4F8B;&#x4E2D;&#x7684; state &#x7ED3;&#x6784;&#x8303;&#x5F0F;&#x5316;&#x4E4B;&#x540E;&#x53EF;&#x80FD;&#x5982;&#x4E0B;&#xFF1A;</p>
<pre><code class="lang-javascript"><span class="token punctuation">{</span>
    posts <span class="token punctuation">:</span> <span class="token punctuation">{</span>
        byId <span class="token punctuation">:</span> <span class="token punctuation">{</span>
            <span class="token string">&quot;post1&quot;</span> <span class="token punctuation">:</span> <span class="token punctuation">{</span>
                id <span class="token punctuation">:</span> <span class="token string">&quot;post1&quot;</span><span class="token punctuation">,</span>
                author <span class="token punctuation">:</span> <span class="token string">&quot;user1&quot;</span><span class="token punctuation">,</span>
                body <span class="token punctuation">:</span> <span class="token string">&quot;......&quot;</span><span class="token punctuation">,</span>
                comments <span class="token punctuation">:</span> <span class="token punctuation">[</span><span class="token string">&quot;comment1&quot;</span><span class="token punctuation">,</span> <span class="token string">&quot;comment2&quot;</span><span class="token punctuation">]</span>    
            <span class="token punctuation">}</span><span class="token punctuation">,</span>
            <span class="token string">&quot;post2&quot;</span> <span class="token punctuation">:</span> <span class="token punctuation">{</span>
                id <span class="token punctuation">:</span> <span class="token string">&quot;post2&quot;</span><span class="token punctuation">,</span>
                author <span class="token punctuation">:</span> <span class="token string">&quot;user2&quot;</span><span class="token punctuation">,</span>
                body <span class="token punctuation">:</span> <span class="token string">&quot;......&quot;</span><span class="token punctuation">,</span>
                comments <span class="token punctuation">:</span> <span class="token punctuation">[</span><span class="token string">&quot;comment3&quot;</span><span class="token punctuation">,</span> <span class="token string">&quot;comment4&quot;</span><span class="token punctuation">,</span> <span class="token string">&quot;comment5&quot;</span><span class="token punctuation">]</span>    
            <span class="token punctuation">}</span>
        <span class="token punctuation">}</span>
        allIds <span class="token punctuation">:</span> <span class="token punctuation">[</span><span class="token string">&quot;post1&quot;</span><span class="token punctuation">,</span> <span class="token string">&quot;post2&quot;</span><span class="token punctuation">]</span>
    <span class="token punctuation">}</span><span class="token punctuation">,</span>
    comments <span class="token punctuation">:</span> <span class="token punctuation">{</span>
        byId <span class="token punctuation">:</span> <span class="token punctuation">{</span>
            <span class="token string">&quot;comment1&quot;</span> <span class="token punctuation">:</span> <span class="token punctuation">{</span>
                id <span class="token punctuation">:</span> <span class="token string">&quot;comment1&quot;</span><span class="token punctuation">,</span>
                author <span class="token punctuation">:</span> <span class="token string">&quot;user2&quot;</span><span class="token punctuation">,</span>
                comment <span class="token punctuation">:</span> <span class="token string">&quot;.....&quot;</span><span class="token punctuation">,</span>
            <span class="token punctuation">}</span><span class="token punctuation">,</span>
            <span class="token string">&quot;comment2&quot;</span> <span class="token punctuation">:</span> <span class="token punctuation">{</span>
                id <span class="token punctuation">:</span> <span class="token string">&quot;comment2&quot;</span><span class="token punctuation">,</span>
                author <span class="token punctuation">:</span> <span class="token string">&quot;user3&quot;</span><span class="token punctuation">,</span>
                comment <span class="token punctuation">:</span> <span class="token string">&quot;.....&quot;</span><span class="token punctuation">,</span>
            <span class="token punctuation">}</span><span class="token punctuation">,</span>
            <span class="token string">&quot;comment3&quot;</span> <span class="token punctuation">:</span> <span class="token punctuation">{</span>
                id <span class="token punctuation">:</span> <span class="token string">&quot;comment3&quot;</span><span class="token punctuation">,</span>
                author <span class="token punctuation">:</span> <span class="token string">&quot;user3&quot;</span><span class="token punctuation">,</span>
                comment <span class="token punctuation">:</span> <span class="token string">&quot;.....&quot;</span><span class="token punctuation">,</span>
            <span class="token punctuation">}</span><span class="token punctuation">,</span>
            <span class="token string">&quot;comment4&quot;</span> <span class="token punctuation">:</span> <span class="token punctuation">{</span>
                id <span class="token punctuation">:</span> <span class="token string">&quot;comment4&quot;</span><span class="token punctuation">,</span>
                author <span class="token punctuation">:</span> <span class="token string">&quot;user1&quot;</span><span class="token punctuation">,</span>
                comment <span class="token punctuation">:</span> <span class="token string">&quot;.....&quot;</span><span class="token punctuation">,</span>
            <span class="token punctuation">}</span><span class="token punctuation">,</span>
            <span class="token string">&quot;comment5&quot;</span> <span class="token punctuation">:</span> <span class="token punctuation">{</span>
                id <span class="token punctuation">:</span> <span class="token string">&quot;comment5&quot;</span><span class="token punctuation">,</span>
                author <span class="token punctuation">:</span> <span class="token string">&quot;user3&quot;</span><span class="token punctuation">,</span>
                comment <span class="token punctuation">:</span> <span class="token string">&quot;.....&quot;</span><span class="token punctuation">,</span>
            <span class="token punctuation">}</span><span class="token punctuation">,</span>
        <span class="token punctuation">}</span><span class="token punctuation">,</span>
        allIds <span class="token punctuation">:</span> <span class="token punctuation">[</span><span class="token string">&quot;comment1&quot;</span><span class="token punctuation">,</span> <span class="token string">&quot;comment2&quot;</span><span class="token punctuation">,</span> <span class="token string">&quot;comment3&quot;</span><span class="token punctuation">,</span> <span class="token string">&quot;commment4&quot;</span><span class="token punctuation">,</span> <span class="token string">&quot;comment5&quot;</span><span class="token punctuation">]</span>
    <span class="token punctuation">}</span><span class="token punctuation">,</span>
    users <span class="token punctuation">:</span> <span class="token punctuation">{</span>
        byId <span class="token punctuation">:</span> <span class="token punctuation">{</span>
            <span class="token string">&quot;user1&quot;</span> <span class="token punctuation">:</span> <span class="token punctuation">{</span>
                username <span class="token punctuation">:</span> <span class="token string">&quot;user1&quot;</span><span class="token punctuation">,</span>
                name <span class="token punctuation">:</span> <span class="token string">&quot;User 1&quot;</span><span class="token punctuation">,</span>
            <span class="token punctuation">}</span>
            <span class="token string">&quot;user2&quot;</span> <span class="token punctuation">:</span> <span class="token punctuation">{</span>
                username <span class="token punctuation">:</span> <span class="token string">&quot;user2&quot;</span><span class="token punctuation">,</span>
                name <span class="token punctuation">:</span> <span class="token string">&quot;User 2&quot;</span><span class="token punctuation">,</span>
            <span class="token punctuation">}</span>
            <span class="token string">&quot;user3&quot;</span> <span class="token punctuation">:</span> <span class="token punctuation">{</span>
                username <span class="token punctuation">:</span> <span class="token string">&quot;user3&quot;</span><span class="token punctuation">,</span>
                name <span class="token punctuation">:</span> <span class="token string">&quot;User 3&quot;</span><span class="token punctuation">,</span>
            <span class="token punctuation">}</span>
        <span class="token punctuation">}</span><span class="token punctuation">,</span>
        allIds <span class="token punctuation">:</span> <span class="token punctuation">[</span><span class="token string">&quot;user1&quot;</span><span class="token punctuation">,</span> <span class="token string">&quot;user2&quot;</span><span class="token punctuation">,</span> <span class="token string">&quot;user3&quot;</span><span class="token punctuation">]</span>
    <span class="token punctuation">}</span>
<span class="token punctuation">}</span>
</code></pre>
<p>&#x8FD9;&#x79CD; state &#x5728;&#x7ED3;&#x6784;&#x4E0A;&#x66F4;&#x52A0;&#x6241;&#x5E73;&#x3002;&#x4E0E;&#x539F;&#x59CB;&#x7684;&#x5D4C;&#x5957;&#x5F62;&#x5F0F;&#x76F8;&#x6BD4;&#xFF0C;&#x6709;&#x4E0B;&#x9762;&#x51E0;&#x4E2A;&#x5730;&#x65B9;&#x7684;&#x6539;&#x8FDB;&#xFF1A;</p>
<ul>
<li>&#x6BCF;&#x4E2A;&#x6570;&#x636E;&#x9879;&#x53EA;&#x5728;&#x4E00;&#x4E2A;&#x5730;&#x65B9;&#x5B9A;&#x4E49;&#xFF0C;&#x5982;&#x679C;&#x6570;&#x636E;&#x9879;&#x9700;&#x8981;&#x66F4;&#x65B0;&#x7684;&#x8BDD;&#x4E0D;&#x7528;&#x5728;&#x591A;&#x5904;&#x6539;&#x53D8;</li>
<li>reducer &#x903B;&#x8F91;&#x4E0D;&#x7528;&#x5904;&#x7406;&#x6DF1;&#x5C42;&#x6B21;&#x7684;&#x5D4C;&#x5957;&#xFF0C;&#x56E0;&#x6B64;&#x770B;&#x4E0A;&#x53BB;&#x53EF;&#x80FD;&#x4F1A;&#x66F4;&#x52A0;&#x7B80;&#x5355;</li>
<li>&#x68C0;&#x7D22;&#x6216;&#x8005;&#x66F4;&#x65B0;&#x7ED9;&#x5B9A;&#x6570;&#x636E;&#x9879;&#x7684;&#x903B;&#x8F91;&#x53D8;&#x5F97;&#x7B80;&#x5355;&#x4E0E;&#x4E00;&#x81F4;&#x3002;&#x7ED9;&#x5B9A;&#x4E00;&#x4E2A;&#x6570;&#x636E;&#x9879;&#x7684; type &#x548C; ID&#xFF0C;&#x4E0D;&#x5FC5;&#x6316;&#x6398;&#x5176;&#x4ED6;&#x5BF9;&#x8C61;&#x800C;&#x662F;&#x901A;&#x8FC7;&#x51E0;&#x4E2A;&#x7B80;&#x5355;&#x7684;&#x6B65;&#x9AA4;&#x5C31;&#x80FD;&#x67E5;&#x627E;&#x5230;&#x5B83;&#x3002;</li>
<li>&#x6BCF;&#x4E2A;&#x6570;&#x636E;&#x7C7B;&#x578B;&#x90FD;&#x662F;&#x552F;&#x4E00;&#x7684;&#xFF0C;&#x50CF;&#x6539;&#x8BC4;&#x8BBA;&#x8FD9;&#x6837;&#x7684;&#x66F4;&#x65B0;&#x4EC5;&#x4EC5;&#x9700;&#x8981;&#x72B6;&#x6001;&#x6811;&#x4E2D; &#x201C;comment &gt; byId &gt; comment&#x201D; &#x8FD9;&#x90E8;&#x5206;&#x7684;&#x590D;&#x5236;&#x3002;&#x8FD9;&#x4E5F;&#x5C31;&#x610F;&#x5473;&#x7740;&#x5728; UI &#x4E2D;&#x53EA;&#x6709;&#x6570;&#x636E;&#x53D1;&#x751F;&#x53D8;&#x5316;&#x7684;&#x4E00;&#x90E8;&#x5206;&#x624D;&#x4F1A;&#x53D1;&#x751F;&#x66F4;&#x65B0;&#x3002;&#x4E0E;&#x4E4B;&#x524D;&#x7684;&#x4E0D;&#x540C;&#x7684;&#x662F;&#xFF0C;&#x4E4B;&#x524D;&#x5D4C;&#x5957;&#x5F62;&#x5F0F;&#x7684;&#x7ED3;&#x6784;&#x9700;&#x8981;&#x66F4;&#x65B0;&#x6574;&#x4E2A; comment &#x5BF9;&#x8C61;&#xFF0C;post &#x5BF9;&#x8C61;&#x7684;&#x7236;&#x7EA7;&#xFF0C;&#x4EE5;&#x53CA;&#x6574;&#x4E2A; post &#x5BF9;&#x8C61;&#x7684;&#x6570;&#x7EC4;&#x3002;&#x8FD9;&#x6837;&#x5C31;&#x4F1A;&#x8BA9;&#x6240;&#x6709;&#x7684; Post &#x7EC4;&#x4EF6;&#x548C; Comment &#x7EC4;&#x4EF6;&#x90FD;&#x518D;&#x6B21;&#x6E32;&#x67D3;&#x3002;</li>
</ul>
<p>&#x9700;&#x8981;&#x6CE8;&#x610F;&#x7684;&#x662F;&#xFF0C;&#x8303;&#x5F0F;&#x5316;&#x7684; state &#x610F;&#x5473;&#x66F4;&#x591A;&#x7684;&#x7EC4;&#x4EF6;&#x88AB; connect&#xFF0C;&#x6BCF;&#x4E2A;&#x7EC4;&#x4EF6;&#x8D1F;&#x8D23;&#x67E5;&#x627E;&#x81EA;&#x5DF1;&#x7684;&#x6570;&#x636E;&#xFF0C;&#x8FD9;&#x548C;&#x5C0F;&#x90E8;&#x5206;&#x7684;&#x7EC4;&#x4EF6;&#x88AB; connect&#xFF0C;&#x7136;&#x540E;&#x67E5;&#x627E;&#x5927;&#x90E8;&#x5206;&#x7684;&#x6570;&#x636E;&#x518D;&#x8FDB;&#x884C;&#x5411;&#x4E0B;&#x4F20;&#x9012;&#x6570;&#x636E;&#x662F;&#x6070;&#x6070;&#x76F8;&#x53CD;&#x7684;&#x3002;&#x4E8B;&#x5B9E;&#x8BC1;&#x660E;&#xFF0C;connect &#x7236;&#x7EC4;&#x4EF6;&#x53EA;&#x9700;&#x8981;&#x5C06;&#x6570;&#x636E;&#x9879;&#x7684; Id &#x4F20;&#x9012;&#x7ED9; connect &#x7684;&#x5B50;&#x5BF9;&#x8C61;&#x662F;&#x5728; Redux &#x5E94;&#x7528;&#x4E2D;&#x4F18;&#x5316; UI &#x6027;&#x80FD;&#x7684;&#x826F;&#x597D;&#x6A21;&#x5F0F;&#xFF0C;&#x56E0;&#x6B64;&#x4FDD;&#x6301;&#x8303;&#x5F0F;&#x5316;&#x7684; state &#x5728;&#x63D0;&#x9AD8;&#x6027;&#x80FD;&#x65B9;&#x9762;&#x8D77;&#x7740;&#x5173;&#x952E;&#x4F5C;&#x7528;&#x3002;</p>
<h2 id="%E7%BB%84%E7%BB%87-state-%E4%B8%AD%E7%9A%84%E8%8C%83%E5%BC%8F%E5%8C%96%E6%95%B0%E6%8D%AE">&#x7EC4;&#x7EC7; State &#x4E2D;&#x7684;&#x8303;&#x5F0F;&#x5316;&#x6570;&#x636E;</h2>
<p>&#x4E00;&#x4E2A;&#x5178;&#x578B;&#x7684;&#x5E94;&#x7528;&#x4E2D;&#x901A;&#x5E38;&#x4F1A;&#x6709;&#x76F8;&#x5173;&#x8054;&#x7684;&#x6570;&#x636E;&#x548C;&#x65E0;&#x5173;&#x8054;&#x6570;&#x636E;&#x7684;&#x6DF7;&#x5408;&#x4F53;&#x3002;&#x867D;&#x7136;&#x6211;&#x4EEC;&#x5BF9;&#x8FD9;&#x79CD;&#x4E0D;&#x540C;&#x7C7B;&#x578B;&#x7684;&#x6570;&#x636E;&#x5E94;&#x8BE5;&#x5982;&#x4F55;&#x7EC4;&#x7EC7;&#x6CA1;&#x6709;&#x4E00;&#x4E2A;&#x5355;&#x4E00;&#x7684;&#x89C4;&#x5219;&#xFF0C;&#x4F46;&#x5E38;&#x89C1;&#x7684;&#x6A21;&#x5F0F;&#x662F;&#x5C06;&#x5173;&#x7CFB; &#x201C;&#x8868;&#x201D; &#x653E;&#x5728;&#x4E00;&#x4E2A;&#x5171;&#x540C;&#x7684;&#x7236; key &#x4E2D;&#xFF0C;&#x6BD4;&#x5982;&#xFF1A;&#x201C;entities&#x201D;&#x3002;&#x901A;&#x8FC7;&#x8FD9;&#x79CD;&#x6A21;&#x5F0F;&#x7EC4;&#x7EC7;&#x7684; state &#x770B;&#x4E0A;&#x53BB;&#x957F;&#x5F97;&#x50CF;&#x8FD9;&#x6837;&#xFF1A;</p>
<pre><code class="lang-javascript"><span class="token punctuation">{</span>
    simpleDomainData1<span class="token punctuation">:</span> <span class="token punctuation">{</span><span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">}</span><span class="token punctuation">,</span>
    simpleDomainData2<span class="token punctuation">:</span> <span class="token punctuation">{</span><span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">}</span>
    entities <span class="token punctuation">:</span> <span class="token punctuation">{</span>
        entityType1 <span class="token punctuation">:</span> <span class="token punctuation">{</span><span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">}</span><span class="token punctuation">,</span>
        entityType2 <span class="token punctuation">:</span> <span class="token punctuation">{</span><span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">}</span>
    <span class="token punctuation">}</span>
    ui <span class="token punctuation">:</span> <span class="token punctuation">{</span>
        uiSection1 <span class="token punctuation">:</span> <span class="token punctuation">{</span><span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">}</span><span class="token punctuation">,</span>
        uiSection2 <span class="token punctuation">:</span> <span class="token punctuation">{</span><span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">}</span>
    <span class="token punctuation">}</span>
<span class="token punctuation">}</span>
</code></pre>
<p>&#x8FD9;&#x6837;&#x53EF;&#x4EE5;&#x901A;&#x8FC7;&#x591A;&#x79CD;&#x65B9;&#x5F0F;&#x8FDB;&#x884C;&#x6269;&#x5C55;&#x3002;&#x6BD4;&#x5982;&#x4E00;&#x4E2A;&#x5BF9; entities &#x8981;&#x8FDB;&#x884C;&#x5927;&#x91CF;&#x7F16;&#x8F91;&#x7684;&#x5E94;&#x7528;&#x53EF;&#x80FD;&#x5E0C;&#x671B;&#x5728; state &#x4E2D;&#x4FDD;&#x6301;&#x4E24;&#x7EC4; &#x201C;&#x8868;&#x201D;&#xFF0C;&#x4E00;&#x4E2A;&#x7528;&#x4E8E;&#x5B58;&#x50A8; &#x201C;&#x5F53;&#x524D;&#x201D;&#xFF08;current&#xFF09; &#x7684;&#x9879;&#x76EE;&#xFF0C;&#x4E00;&#x4E2A;&#x7528;&#x4E8E;&#x5B58;&#x50A8; &#x201C;&#x6B63;&#x5728;&#x8FDB;&#x884C;&#x4E2D;&#x201D;(work-in-progress) &#x7684;&#x9879;&#x76EE;&#x3002;&#x5F53;&#x6570;&#x636E;&#x9879;&#x5728;&#x88AB;&#x7F16;&#x8F91;&#x7684;&#x65F6;&#x5019;&#xFF0C;&#x5176;&#x503C;&#x53EF;&#x4EE5;&#x88AB;&#x590D;&#x5236;&#x5230; &#x201C;&#x6B63;&#x5728;&#x8FDB;&#x884C;&#x4E2D;&#x201D; &#x7684;&#x90A3;&#x4E2A;&#x8868;&#x4E2D;&#xFF0C;&#x4EFB;&#x4F55;&#x66F4;&#x65B0;&#x4ED6;&#x7684;&#x52A8;&#x4F5C;&#x90FD;&#x5C06;&#x5728; &#x201C;&#x6B63;&#x5728;&#x8FDB;&#x884C;&#x4E2D;&#x201D; &#x7684;&#x8868;&#x4E2D;&#x5DE5;&#x4F5C;&#xFF0C;&#x7F16;&#x8F91;&#x8868;&#x5355;&#x88AB;&#x8BE5;&#x7EC4;&#x6570;&#x636E;&#x63A7;&#x5236;&#x7740;&#xFF0C;UI &#x4ECD;&#x7136;&#x88AB;&#x539F;&#x59CB;&#x6570;&#x636E;&#x63A7;&#x5236;&#x7740;&#x3002;&#x8868;&#x5355;&#x7684; &#x201C;&#x91CD;&#x7F6E;&#x201D; &#x901A;&#x8FC7;&#x79FB;&#x9664; &#x201C;&#x6B63;&#x5728;&#x8FDB;&#x884C;&#x4E2D;&#x201D; &#x8868;&#x7684;&#x6570;&#x636E;&#x9879;&#x7136;&#x540E;&#x4ECE; &#x201C;&#x5F53;&#x524D;&#x201D; &#x8868;&#x4E2D;&#x590D;&#x5236;&#x539F;&#x59CB;&#x6570;&#x636E;&#x5230; &#x201C;&#x6B63;&#x5728;&#x8FDB;&#x884C;&#x4E2D;&#x201D; &#x8868;&#x4E2D;&#x5C31;&#x80FD;&#x8F7B;&#x6613;&#x505A;&#x5230;&#xFF0C;&#x8868;&#x5355;&#x7684; &#x201C;&#x5E94;&#x7528;&#x201D; &#x901A;&#x8FC7;&#x628A; &#x201C;&#x6B63;&#x5728;&#x8FDB;&#x884C;&#x4E2D;&#x201D; &#x8868;&#x7684;&#x6570;&#x636E;&#x590D;&#x5236;&#x5230; &#x201C;&#x5F53;&#x524D;&#x201D; &#x8868;&#x4E2D;&#x5C31;&#x80FD;&#x5B9E;&#x73B0;&#x3002;</p>
<h2 id="%E8%A1%A8%E9%97%B4%E5%85%B3%E7%B3%BB">&#x8868;&#x95F4;&#x5173;&#x7CFB;</h2>
<p>&#x56E0;&#x4E3A;&#x6211;&#x4EEC;&#x5C06; Redux Store &#x89C6;&#x4E3A;&#x6570;&#x636E;&#x5E93;&#xFF0C;&#x6240;&#x4EE5;&#x5728;&#x5F88;&#x591A;&#x6570;&#x636E;&#x5E93;&#x7684;&#x8BBE;&#x8BA1;&#x89C4;&#x5219;&#x5728;&#x8FD9;&#x91CC;&#x4E5F;&#x662F;&#x9002;&#x7528;&#x7684;&#x3002;&#x4F8B;&#x5982;&#xFF0C;&#x5BF9;&#x4E8E;&#x591A;&#x5BF9;&#x591A;&#x7684;&#x5173;&#x7CFB;&#xFF0C;&#x53EF;&#x4EE5;&#x8BBE;&#x8BA1;&#x4E00;&#x5F20;&#x4E2D;&#x95F4;&#x8868;&#x5B58;&#x50A8;&#x76F8;&#x5173;&#x8054;&#x9879;&#x76EE;&#x7684; ID&#xFF08;&#x7ECF;&#x5E38;&#x88AB;&#x79F0;&#x4F5C; &#x201C;&#x8FDE;&#x63A5;&#x8868;&#x201D; &#x6216;&#x8005; &#x201C;&#x5173;&#x8054;&#x8868;&#x201D;&#xFF09;&#x3002;&#x4E3A;&#x4E86;&#x4E00;&#x81F4;&#x8D77;&#x89C1;&#xFF0C;&#x6211;&#x4EEC;&#x8FD8;&#x4F1A;&#x4F7F;&#x7528;&#x76F8;&#x540C;&#x7684; <code>byId</code> &#x548C; <code>allIds</code> &#x7528;&#x4E8E;&#x5B9E;&#x9645;&#x7684;&#x6570;&#x636E;&#x9879;&#x8868;&#x4E2D;&#x3002;</p>
<pre><code class="lang-javascript"><span class="token punctuation">{</span>
    entities<span class="token punctuation">:</span> <span class="token punctuation">{</span>
        authors <span class="token punctuation">:</span> <span class="token punctuation">{</span> byId <span class="token punctuation">:</span> <span class="token punctuation">{</span><span class="token punctuation">}</span><span class="token punctuation">,</span> allIds <span class="token punctuation">:</span> <span class="token punctuation">[</span><span class="token punctuation">]</span> <span class="token punctuation">}</span><span class="token punctuation">,</span>
        books <span class="token punctuation">:</span> <span class="token punctuation">{</span> byId <span class="token punctuation">:</span> <span class="token punctuation">{</span><span class="token punctuation">}</span><span class="token punctuation">,</span> allIds <span class="token punctuation">:</span> <span class="token punctuation">[</span><span class="token punctuation">]</span> <span class="token punctuation">}</span><span class="token punctuation">,</span>
        authorBook <span class="token punctuation">:</span> <span class="token punctuation">{</span>
            byId <span class="token punctuation">:</span> <span class="token punctuation">{</span>
                <span class="token number">1</span> <span class="token punctuation">:</span> <span class="token punctuation">{</span>
                    id <span class="token punctuation">:</span> <span class="token number">1</span><span class="token punctuation">,</span>
                    authorId <span class="token punctuation">:</span> <span class="token number">5</span><span class="token punctuation">,</span>
                    bookId <span class="token punctuation">:</span> <span class="token number">22</span>
                <span class="token punctuation">}</span><span class="token punctuation">,</span>
                <span class="token number">2</span> <span class="token punctuation">:</span> <span class="token punctuation">{</span>
                    id <span class="token punctuation">:</span> <span class="token number">2</span><span class="token punctuation">,</span>
                    authorId <span class="token punctuation">:</span> <span class="token number">5</span><span class="token punctuation">,</span>
                    bookId <span class="token punctuation">:</span> <span class="token number">15</span><span class="token punctuation">,</span>
                <span class="token punctuation">}</span>
                <span class="token number">3</span> <span class="token punctuation">:</span> <span class="token punctuation">{</span>
                    id <span class="token punctuation">:</span> <span class="token number">3</span><span class="token punctuation">,</span>
                    authorId <span class="token punctuation">:</span> <span class="token number">42</span><span class="token punctuation">,</span>
                    bookId <span class="token punctuation">:</span> <span class="token number">12</span>
                <span class="token punctuation">}</span>
            <span class="token punctuation">}</span><span class="token punctuation">,</span>
            allIds <span class="token punctuation">:</span> <span class="token punctuation">[</span><span class="token number">1</span><span class="token punctuation">,</span> <span class="token number">2</span><span class="token punctuation">,</span> <span class="token number">3</span><span class="token punctuation">]</span>

        <span class="token punctuation">}</span>
    <span class="token punctuation">}</span>
<span class="token punctuation">}</span>
</code></pre>
<p>&#x50CF; &#x201C;&#x67E5;&#x627E;&#x8FD9;&#x4E2A;&#x4F5C;&#x8005;&#x6240;&#x6709;&#x7684;&#x4E66;&#x201D; &#x8FD9;&#x4E2A;&#x64CD;&#x4F5C;&#x53EF;&#x4EE5;&#x901A;&#x8FC7;&#x5728;&#x8FDE;&#x63A5;&#x8868;&#x4E0A;&#x4E00;&#x4E2A;&#x5355;&#x4E00;&#x7684;&#x5FAA;&#x73AF;&#x6765;&#x5B9E;&#x73B0;&#x3002;&#x76F8;&#x5BF9;&#x4E8E;&#x5E94;&#x7528;&#x4E2D;&#x4E00;&#x822C;&#x60C5;&#x51B5;&#x4E0B;&#x6570;&#x636E;&#x91CF;&#x548C; JavaScript &#x5F15;&#x64CE;&#x7684;&#x8FD0;&#x884C;&#x901F;&#x5EA6;&#xFF0C;&#x5728;&#x5927;&#x591A;&#x6570;&#x60C5;&#x51B5;&#x4E0B;&#xFF0C;&#x8FD9;&#x6837;&#x64CD;&#x4F5C;&#x7684;&#x6027;&#x80FD;&#x662F;&#x8DB3;&#x591F;&#x597D;&#x7684;&#x3002;</p>
<h2 id="%E5%B5%8C%E5%A5%97%E6%95%B0%E6%8D%AE%E8%8C%83%E5%BC%8F%E5%8C%96">&#x5D4C;&#x5957;&#x6570;&#x636E;&#x8303;&#x5F0F;&#x5316;</h2>
<p>&#x56E0;&#x4E3A; API &#x7ECF;&#x5E38;&#x4EE5;&#x5D4C;&#x5957;&#x7684;&#x5F62;&#x5F0F;&#x53D1;&#x9001;&#x8FD4;&#x56DE;&#x6570;&#x636E;&#xFF0C;&#x6240;&#x4EE5;&#x8BE5;&#x6570;&#x636E;&#x9700;&#x8981;&#x5728;&#x5F15;&#x5165;&#x72B6;&#x6001;&#x6811;&#x4E4B;&#x524D;&#x8F6C;&#x5316;&#x4E3A;&#x89C4;&#x8303;&#x5316;&#x5F62;&#x6001;&#x3002;<a href="https://github.com/paularmstrong/normalizr" target="_blank">Normalizr</a> &#x5E93;&#x53EF;&#x4EE5;&#x5E2E;&#x52A9;&#x4F60;&#x5B9E;&#x73B0;&#x8FD9;&#x4E2A;&#x3002;&#x4F60;&#x53EF;&#x4EE5;&#x5B9A;&#x4E49; schema &#x7684;&#x7C7B;&#x578B;&#x548C;&#x5173;&#x7CFB;&#xFF0C;&#x5C06; schema &#x548C;&#x54CD;&#x5E94;&#x6570;&#x636E;&#x63D0;&#x4F9B;&#x7ED9; Normalizr&#xFF0C;&#x4ED6;&#x4F1A;&#x8F93;&#x51FA;&#x54CD;&#x5E94;&#x6570;&#x636E;&#x7684;&#x8303;&#x5F0F;&#x5316;&#x53D8;&#x6362;&#x3002;&#x8F93;&#x51FA;&#x53EF;&#x4EE5;&#x653E;&#x5728; action &#x4E2D;&#xFF0C;&#x7528;&#x4E8E; store &#x7684;&#x66F4;&#x65B0;&#x3002;&#x6709;&#x5173;&#x5176;&#x7528;&#x6CD5;&#x7684;&#x66F4;&#x591A;&#x8BE6;&#x7EC6;&#x4FE1;&#x606F;&#xFF0C;&#x8BF7;&#x53C2;&#x9605; Normalizr &#x6587;&#x6863;&#x3002;</p>

                    
                    </section>
                
                
                </div>
            </div>
        </div>

        
        <a href="../../../docs/recipes/reducers/BeyondCombineReducers.html" class="navigation navigation-prev " aria-label="Previous page: `combineReducers` 进阶"><i class="fa fa-angle-left"></i></a>
        
        
        <a href="../../../docs/recipes/reducers/UpdatingNormalizedData.html" class="navigation navigation-next " aria-label="Next page: 管理范式化数据"><i class="fa fa-angle-right"></i></a>
        
    </div>
</div>

        
<script src="../../../gitbook/app.js"></script>

    
    <script src="../../../gitbook/plugins/gitbook-plugin-edit-link/plugin.js"></script>
    

    
    <script src="../../../gitbook/plugins/gitbook-plugin-ga/plugin.js"></script>
    

<script>
require(["gitbook"], function(gitbook) {
    var config = {"fontSettings":{"theme":null,"family":"sans","size":2},"edit-link":{"base":"https://github.com/camsong/redux-in-chinese/tree/master","label":"开始纠错"},"ga":{"token":"UA-66122997-1","configuration":"auto"}};
    gitbook.start(config);
});
</script>

        <script>(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)})(window,document,'script','//www.google-analytics.com/analytics.js','ga');ga('create', 'UA-66122997-1', 'auto');ga('send', 'pageview');</script>
    </body>
    
</html>
